/*
 * Copyright (c) 2020 hebeiyiliuba.com
 * All rights reserved.
 *
 */
package org.jeecg.common.constant.enums;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * 上报平台类型
 *
 * @author duanlikao
 * @created 2020/12/14
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum ReportPlatformEnum {

    REPORT_PLATFORM_NONE(0, "暂无"),
    REPORT_PLATFORM_HB(1, "河北"),
    REPORT_PLATFORM_TJ(2, "天津"),
    REPORT_PLATFORM_AH(3, "安徽"),
    REPORT_PLATFORM_JS(4, "江苏"),
    REPORT_PLATFORM_SX(5, "山西"),
    REPORT_PLATFORM_SD(6, "山东"),
    REPORT_PLATFORM_HUBEI(7, "湖北"),
    REPORT_PLATFORM_JX(8, "江西"),
    REPORT_PLATFORM_LN(9, "辽宁"),
    REPORT_PLATFORM_HUAIBEI(10, "淮北"),
    REPORT_PLATFORM_HENAN(11, "河南"),
    REPORT_PLATFORM_HLJ(12, "黑龙江"),
    REPORT_PLATFORM_YUNNAN(13, "云南"),
    REPORT_PLATFORM_XINJIANG(14, "新疆"),
    REPORT_PLATFORM_NINGXIA(15, "宁夏"),
    REPORT_PLATFORM_NEIMENGGU(16, "内蒙古"),
    REPORT_PLATFORM_CHONGQING(17, "重庆"),
    REPORT_PLATFORM_JSV2(18, "江苏"),
    REPORT_PLATFORM_GUIZHOU(19, "贵州"),
    REPORT_PLATFORM_SHAANXI(20, "陕西"),
    REPORT_PLATFORM_MINGNA(99, "铭钠"),
    REPORT_PLATFORM_XZ(100, "产业园区"),
    REPORT_PLATFORM_ZJ(101, "中交兴路平台"),
    REPORT_PLATFORM_ORDOS(200, "鄂尔多斯市"),


    REPORT_PLATFORM_ORDER(888,"一键补单")
    ;

    private Integer code;
    private String msg;

    private static Map<Integer, ReportPlatformEnum> codeMap = Maps.newHashMap();

    public Integer getCode() {
        return this.code;
    }

    public String getDesc() {
        return this.msg;
    }

    public static String getMsg(Integer code) {
        return codeMap.containsKey(code) ? codeMap.get(code).getDesc() : StringUtils.EMPTY;
    }

    public static boolean isValid(Integer code) {
        return codeMap.containsKey(code);
    }

    static {
        for (ReportPlatformEnum status : ReportPlatformEnum.values()) {
            codeMap.put(status.getCode(), status);
        }
    }

    public static ReportPlatformEnum getReportPlatformEnumByVal(Integer code) {
        return codeMap.get(code);
    }

}
